package com.investmenttechnologyservices.model;

import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.Key;

public class Issuer extends EntityHolder {
	//@Id 
	//private String key;
	//private Key<UserITS> firmKey;  // null is public issuer
	//private String name;
	/**
	 * Issuer can be IBM Canada, IBM USA and the parent can be IBM Global
	 * Can be NULL.
	 */
	//@Parent 
	//private Key<Issuer> issuerParentKey;
	
	public Issuer(Entity entity) {
		super(entity);
	}
	
	public Issuer(String id) {
	    super("issuer", id);
	}
	
	public Issuer(String id, Key issuerParentKey) {
		super("issuer", id, issuerParentKey);
	}

	public Issuer(String id, String name, Key firmKey, Key issuerParentKey) {
		this(id, issuerParentKey);
		setName(name);
		setFirmKey(firmKey);
	}

	public Issuer(String id, String name, Key firmKey) {
		this(id);
		setName(name);
		setFirmKey(firmKey);
	} 

	public Issuer(String id, String name) {
		this(id);
		setName(name);
	} 

	public String getId() {return super.getId();}
	
	public Key getFirmKey() {
		return (Key) getProperty("firmKey");
	}

	public void setFirmKey(Key firmKey) {
		setProperty("firmKey", firmKey);
	}

	public String getName() {
		return (String) getProperty("name");
	}

	public void setName(String name) {
		setProperty("name", name);
	}

	public Key getIssuerKey() {
		return (Key)getProperty("issuerKey");
	}

	public void setIssuerKey(Key issuerKey) {
		setProperty("issuerKey", issuerKey);
	}
	
	@Override
	public String toString() {
		return "Issuer [key=" + getId() + ", name=" + getName() + ", issuerParentKey="
				+ getParentId() + "]";
	} 
	
	
	
}
